package com.hhf.rpc.core.serializer;

import java.io.IOException;

/**
 * @Author hhf
 * @Date 2024/10/15
 * @Description 抽象序列化器
 */
public interface Serializer {

    /**
     * 序列化
     * @param object
     * @return
     * @param <T>
     * @throws IOException
     */
    <T> byte[] serialize(T object) throws IOException;

    /**
     * 反序列化
     * @param bytes
     * @param type
     * @return
     * @param <T>
     * @throws IOException
     */
    <T> T deSerialize(byte[] bytes,Class<T> type) throws IOException;
}
